package com.csjy.migration.hnnd.workflow;

import com.csjy.migration.hnnd.BusinessTool;
import com.csjy.migration.hnnd.DbUtil;
import com.csjy.migration.hnnd.DictTool;
import com.csjy.migration.hnnd.ProgramArgument;
import com.csjy.migration.hnnd.annotation.Task;
import com.csjy.migration.hnnd.business.SourceBusinessData;
import com.csjy.migration.hnnd.dict.ProductType;
import com.csjy.migration.hnnd.dict.SysOrgCode;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 申请利息补贴
 */
public class ItemAskSubsity extends WorkflowMigration {

    public ItemAskSubsity(DbUtil sourceDbUtil, DbUtil targetDbUtil, SourceBusinessData sourceData, ProgramArgument programArgument, String projectId, String procInstId, Map procInstRow) throws Exception {
        super(sourceDbUtil, targetDbUtil, sourceData, programArgument, projectId, procInstId, procInstRow);
        customInitData();
    }

    @Override
    public void customInitData() throws SQLException {
        this.curBizType = "lxbc";
    }

    @Override
    public void customInsertOrUpdateData() throws SQLException {

    }


    @Task("申请利息补贴@项目经理提交申请")
    public void sqlxbtxmjltjsq() throws Exception {

        this.curAffixTypeCommon = "sqdj";
        this.curModelMap.put("分公司财务",new String[]{"task1543472493818fgscw","分公司财务"});
        this.curModelMap.put("分公司负责人",new String[]{"task1543472495998fgsfzr","分公司负责人"});

        this.curCustomData.put("paymentName",this.getJbpmVarInstValueByName("payName"));//开户行
        this.curCustomData.put("paymentAccount",this.getJbpmVarInstValueByName("payAccount"));//支付账号
        this.curCustomData.put("depositBank",this.getJbpmVarInstValueByName("payBank"));//开户银行及支行
        this.curCustomData.put("productName", DictTool.getTargetDictCode(ProductType.class,this.getJbpmVarInstValueByName("produceClass")));//产品名称
        this.curCustomData.put("subsidyAmount",this.getJbpmVarInstValueByName("askSum"));//补贴金额
        this.curCustomData.put("depart",DictTool.getTargetDictCode(SysOrgCode.class,this.getJbpmVarInstValueByName("orgCode")));//所属部门
        this.curCustomData.put("subsidyRate",this.getJbpmVarInstValueByName("payRate"));//年利率


        this.curCustomData.put("occurTime",this.getJbpmVarInstValueByName("occurTime"));//年利率
        this.curCustomData.put("connAccountList",this.getJbpmVarInstValueByName("connAccountList"));//年利率

        this.curCustomData.put("managerA",BusinessTool.getEmpCode(this.getJbpmVarInstValueByName("managerA")));//A经理
        this.curCustomData.put("managerB", BusinessTool.getEmpCode(this.getJbpmVarInstValueByName("managerB")));//B经理

        this.curCustomData.put("repaymentInformation",null);//还款信息

        this.setCommonData(false,null);
    }

    @Task("申请利息补贴@分公司财务审核")
    public void sqlxbtfgscwsh() throws Exception {

        this.curModelMap.put("同意",new String[]{"task1543472495998ty","同意"});
        this.curModelMap.put("不同意",new String[]{"endbty","不同意"});

        this.setCommonData(false,null);
    }

    @Task("申请利息补贴@分公司负责人审核")
    public void sqlxbtfgsfzrsh() throws Exception {

        this.curModelMap.put("同意",new String[]{"task1543472500255ty","同意"});
        this.curModelMap.put("不同意",new String[]{"endbty","不同意"});

        this.setCommonData(false,null);
    }

    @Task("申请利息补贴@财务经办人审核")
    public void sqlxbtcwjbrsh() throws Exception {

        this.curModelMap.put("同意",new String[]{"task1543472503945ty","同意"});
        this.curModelMap.put("不同意",new String[]{"endbty","不同意"});

        this.curCustomData.put("depositBank",this.getJbpmVarInstValueByName("ex_payBank"));//A经理
        this.curCustomData.put("paymentAccount",this.getJbpmVarInstValueByName("ex_payAccount"));//B经理
        this.curCustomData.put("subsidyAmount",this.getJbpmVarInstValueByName("ex_askSum"));//还款信息

        this.setCommonData(false,null);
    }

    @Task("申请利息补贴@财务部门经理审核")
    public void sqlxbtcwbfjlsh() throws Exception {
        this.curModelMap.put("同意",new String[]{"endtg","通过"});
        this.curModelMap.put("不同意",new String[]{"endbty","不同意"});
        this.setCommonData(false,null);
    }
}
